package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.dto.LuntaiPolicyExtensionRequestDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LuntaiPolicyExtensionRequest;
import com.ruoyi.system.service.ILuntaiPolicyExtensionRequestService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 保单延保申请记录Controller
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/system/request")
public class LuntaiPolicyExtensionRequestController extends BaseController
{
    @Autowired
    private ILuntaiPolicyExtensionRequestService luntaiPolicyExtensionRequestService;

    /**
     * 查询保单延保申请记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:request:list')")
    @GetMapping("/list")
    public TableDataInfo list(LuntaiPolicyExtensionRequest luntaiPolicyExtensionRequest)
    {
        startPage();
        List<LuntaiPolicyExtensionRequest> list = luntaiPolicyExtensionRequestService.selectLuntaiPolicyExtensionRequestList(luntaiPolicyExtensionRequest);
        return getDataTable(list);
    }
    /**
     * 查询保单延保申请记录列表2
     */
    @PreAuthorize("@ss.hasPermi('system:request:list')")
    @PostMapping("/list2")
    public TableDataInfo list2(LuntaiPolicyExtensionRequestDto luntaiPolicyExtensionRequestDto)
    {
        startPage();
        List<LuntaiPolicyExtensionRequestDto> list = luntaiPolicyExtensionRequestService.selectLuntaiPolicyExtensionRequestList2(luntaiPolicyExtensionRequestDto);
        return getDataTable(list);
    }
    /**
     * 查询保单延保申请记录列表3带管理员信息
     */
    @PreAuthorize("@ss.hasPermi('system:request:list')")
    @PostMapping("/list3")
    public TableDataInfo list3(LuntaiPolicyExtensionRequestDto luntaiPolicyExtensionRequestDto)
    {
        startPage();
        List<LuntaiPolicyExtensionRequestDto> list = luntaiPolicyExtensionRequestService.selectLuntaiPolicyExtensionRequestList3(luntaiPolicyExtensionRequestDto);
        return getDataTable(list);
    }

    /**
     * 导出保单延保申请记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:request:export')")
    @Log(title = "保单延保申请记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LuntaiPolicyExtensionRequest luntaiPolicyExtensionRequest)
    {
        List<LuntaiPolicyExtensionRequest> list = luntaiPolicyExtensionRequestService.selectLuntaiPolicyExtensionRequestList(luntaiPolicyExtensionRequest);
        ExcelUtil<LuntaiPolicyExtensionRequest> util = new ExcelUtil<LuntaiPolicyExtensionRequest>(LuntaiPolicyExtensionRequest.class);
        util.exportExcel(response, list, "保单延保申请记录数据");
    }

    /**
     * 获取保单延保申请记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:request:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(luntaiPolicyExtensionRequestService.selectLuntaiPolicyExtensionRequestById(id));
    }

    /**
     * 新增保单延保申请记录
     */
    @PreAuthorize("@ss.hasPermi('system:request:add')")
    @Log(title = "保单延保申请记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody LuntaiPolicyExtensionRequest luntaiPolicyExtensionRequest)
    {
        return toAjax(luntaiPolicyExtensionRequestService.insertLuntaiPolicyExtensionRequest(luntaiPolicyExtensionRequest));
    }

    /**
     * 修改保单延保申请记录
     */
    @PreAuthorize("@ss.hasPermi('system:request:edit')")
    @Log(title = "保单延保申请记录", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody LuntaiPolicyExtensionRequest luntaiPolicyExtensionRequest)
    {
        return toAjax(luntaiPolicyExtensionRequestService.updateLuntaiPolicyExtensionRequest(luntaiPolicyExtensionRequest));
    }

    /**
     * 删除保单延保申请记录
     */
    @PreAuthorize("@ss.hasPermi('system:request:remove')")
    @Log(title = "保单延保申请记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(luntaiPolicyExtensionRequestService.deleteLuntaiPolicyExtensionRequestByIds(ids));
    }
}
